﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

namespace ProjectMadaktariMVC.Models
{
    public class ConfigurationDAO
    {
        private static MadaktariDataContext db = DBFactory.DB;

        /// <summary>
        /// Returns all hospitals in the system
        /// </summary>
        /// <returns></returns>
        public static List<Hospital> GetHospitals()
        {
            return db.Hospitals.ToList<Hospital>();
        }

        /// <summary>
        /// Returns all referal locations in the system
        /// </summary>
        /// <returns></returns>
        public static List<ReferalLocation> GetReferalLocations()
        {
            return db.ReferalLocations.ToList<ReferalLocation>();
        }

        /// <summary>
        /// Returns all Diagnosies
        /// </summary>
        /// <returns></returns>
        public static List<Diagnosi> GetDiagnoses()
        {
            return db.Diagnosis.ToList<Diagnosi>();
        }

        /// <summary>
        /// Returns a Diagnosis with the specified id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Diagnosi GetDiagnosisById(int id)
        {
            return db.Diagnosis.Single(d => d.diagnosisID == id);
        }

        /// <summary>
        /// Returns all of the concomitant diagnoses in the system.
        /// </summary>
        /// <returns></returns>
        public static List<ConcomitantDiagnosi> GetConcomitantDiagnoses()
        {
            return db.ConcomitantDiagnosis.ToList<ConcomitantDiagnosi>();
        }

        /// <summary>
        /// Returns concomitant diagnosis with given id.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static ConcomitantDiagnosi GetConcomitantDiagnosis(int id)
        {
            return db.ConcomitantDiagnosis.Single(c => c.concomitantDiagnosisID == id);
        }

        /// <summary>
        /// Returns all Procedure Types in the system
        /// </summary>
        /// <returns></returns>
        public static List<ProcedureType> GetProcedureTypes()
        {
            return db.ProcedureTypes.ToList<ProcedureType>();
        }

        /// <summary>
        /// Returns all surgeons in the system
        /// </summary>
        /// <returns></returns>
        public static List<Surgeon> GetSurgeons()
        {
            return db.Surgeons.ToList<Surgeon>();
        }

    }
}
